<extend name="Public/base"/>

<block name="body">
<link rel="stylesheet" type="text/css" href="__STATIC__/datetimepicker/css/datetimepicker_blue.css">
 <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="__JS__/jquery.nicescroll.js"></script>
<style type="text/css">
	.choosed{
		height: 100%;
	}
	.not-choosed{
		height: 100%;
	}
	.fl{
		float: left;
		margin:0 10px;
	}
	.well{
		background: #fff;
	}
	.date{
		width:220px;
		float:left;
	}
	  #img-box{
	    height:150px;
	    width: 150px;
	    margin: 5px 0;
	  }
	</style>
<style>.input-group {width:50%}</style>
    <div class="main-title">
        <h2>新增学生</h2>
    </div>
        <form action="{:U()}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">学号<span class="check-tips">（依据学号生成的用户名将不能更改，必填）</span></label>
            <input type='text' name='sno' value='{$_list.sno_s}' class='form-control' />
            <label class="item-label">姓名<span class="check-tips">（必填）</span></label>
            <input type='text' name='username' value='{$_list.username}' class='form-control' />
            <div class="form-item">
			    <label>学生图片</label>
			    <input id="file_upload" name="file_upload" type="file"
			        multiple="true" value="" />
			        <img id="img-box" src="__ROOT__/public/images/icon.jpg">
			    <input id="picture" type="hidden"  name="picture" value="" />
			  </div>
            <label class="item-label">身份证号</label>
            <input type='text' name='cardid' value='{$_list.cardid}' class='form-control' />
            <label class="item-label">性别</label>
				<label class="radio-inline">
				  <input type="radio" name="sex" id="inlineRadio1" value="0" <if condition="$_list['sex']==0">checked<else/></if>> 男
				</label>
				<label class="radio-inline">
				  <input type="radio" name="sex" id="inlineRadio2" value="1" <if condition="$_list['sex']==1">checked<else/></if>> 女
				</label>
            <label class="item-label">出生年月</label>
   			<input id="startDate" class="form-control dateTime " type="text" value="{$_list.birthday}" name="birthday" readonly/>
            <label class="item-label">民族</label>
            <input type='text' name='national' value='{$_list.national}' class='form-control' />
            <label class="item-label">城市</label>
            <input type='text' name='city' value='{$_list.city}' class='form-control' />
            <label class="item-label">实际居住地</label>
            <input type='text' name='actual_residence' value='{$_list.actual_residence}' class='form-control' />
            <label class="item-label">家长姓名</label>
            <input type='text' name='parent_name' value='{$_list.parent_name}' class='form-control' />
            <label class="item-label">家长联系电话</label>
            <input type='text' name='parent_tel' value='{$_list.parent_tel}' class='form-control' />
            <label class="item-label">园区</label>
            <input type='text' name='park' value='{$_list.park}' class='form-control' />
			
        </div>
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('Student/index')}');
        
        $('#startDate').datetimepicker({
        	format: 'yyyy-mm-dd',
            language:  'zh-CN',
            weekStart: 1,
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });
        $(function(){
            var img  = '';
            $("#file_upload").uploadify({
              "height"          : 30,
              "swf"             : "__STATIC__/uploadify/uploadify.swf",
              "fileObjName"     : "download",
              "buttonText"      : "上传图片",
              "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
              "width"           : 150,
              'removeTimeout'   : 1,
              'fileTypeExts'    : '*.jpg; *.png; *.gif;',
              "onUploadSuccess" : uploadPicture,
              'onFallback' : function() {
                  alert('未检测到兼容版本的Flash.');
              }
          });
            function uploadPicture(file, data){
                var data = $.parseJSON(data);
                var src  = '';
                if(data.status){
                  src = data.url || '__ROOT__' + data.path;
                  $("#img-box").attr("src",src);
                  $("#picture").val(data.path);
                } else {
                  updateAlert(data.info);
                  setTimeout(function(){
                        $('#top-alert').find('button').click();
                        $(that).removeClass('disabled').prop('disabled',false);
                    },1500);
                }
              }
              })
    </script>
</block>
